//************************************************VFS FILE CONTENTS****************************************************************
struct file_descriptor{
	
	char filename[50];
	char path[200];
	int file_type;
	long file_size;
	long block_no;

};

typedef struct file_descriptor FD;

struct free_list{

	int block;
	int isfree;
};

typedef struct free_list List;

struct block{
	int num;
	char buffer[1024];
};

typedef struct block Block;

struct main_header{
	
	char vfslabel[30];
	int max_FD;
	int used_FD;
	int num_blocks;
	long size;
	List freelist[1000];
	FD fd_list[1000];
	
};

typedef struct main_header Header;

Header *header;

//**************************************************N-ARY TREE******************************************************************


struct nary_tree{

	FD* desc;
	struct nary_tree *left;
	struct nary_tree *right;

};

struct head{
	FD* droot;
	struct nary_tree *left;
};

typedef struct head* HEAD;
typedef struct nary_tree* Tree;

HEAD add_root(HEAD,FD*);

HEAD add_node(HEAD,FD*,int);

void display(HEAD );

void display_nodes(Tree );

HEAD delete_root(HEAD ,FD*);

HEAD delete_node(HEAD,Tree ,FD*);

void list_node(HEAD,FD*,int,char []);

void list_root(HEAD,FD *,int,char []);

HEAD movedirectory(HEAD,FD *,FD *);

FD * search(HEAD, FD *);

void unmount(Tree,FD* [],int *);

HEAD movedirectory_home(HEAD,FD*,FD*);

HEAD move_file(HEAD,FD*,FD*,int,char[]);

HEAD movefile_home(HEAD,FD*,FD*,int,char[]);

void change_path(Tree,Tree);

//*****************************************************HASHTABLE************************************************************************


typedef struct node* np;

typedef struct node{
np next;
FD *fdes;
}node;




void hash_table();

int hashing(int);

int hash_insertion(FD *,int);

void hashtable_insert(FD *);

//int hash_search(char []);

np hash_search(char []);

void hash_traversal();

int hash_deletion(FD *);

void hash_move(char [], Tree);

//*******************************************************BINARY SEARCH TREE********************************************************

 struct bst_node {
                FD *fileDesc;          
                struct bst_node* left;
                struct bst_node* right;
                struct bst_node* parent;
        };
       
	typedef struct bst_node bst;
 
        bst* insert(bst *,FD *);
        void inorder(bst *);
        void displayList(bst *);
        bst* searchResult(char *,bst *);
        bst* search_bst(bst *,char *);
        bst* findMin(bst *);
        void transplant(bst *,bst *,bst*);
        void delete_bst(char *,bst *);

//*******************************************************TRIES****************************************************************

struct trie_node
{
    int value;
    struct trie_node *children[26];
};

typedef struct trie_node* Trie;

struct trie
{
    Trie root;
    int count;
};

typedef struct trie trie_structure;


struct list
{
	char file[20];
	char full_path[100];
	struct list *link;
};

typedef struct list content;

content * add_list(content *,FD*);

void display_list(content *,FILE*);



//*****************************************************IN-MEMORY********************************************************************

struct in_mem{

	HEAD naryroot;
	np hashtable[27];
	bst *bstRoot;
};

struct in_mem roots;

int making,dir_empty,source_exist,movefile_err,mounted,list_dir_fail;
char filesystem_name[100];

FILE *list_dir;



